package com.zyf.concurrency.chapter16;


/**
 * 线程安全的延迟初始化
 * create by yifeng
 */
public class safeLazyInitialization {
    private static Resource resource;

    public synchronized static Resource getInstance() {
        if (resource == null)
            resource = new Resource();
        return resource;
    }

    static class Resource {}
}
